package io.gitee.hchaojie.day08.thread.exam2;

public class Consumer implements Runnable {
    private Factory factory;
    public Consumer(Factory factory) {
        this.factory = factory;
    }

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep((long) (Math.random() * 20));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            factory.get();
        }
    }
}
